package Parser;

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

public class RawInformationParcer {

//	private int typeSource;
	private int idSource;
	private int idInformation;


	 public static Logger log = Logger.getLogger("log_file");
	 FileHandler hand;
	
	public RawInformationParcer() {
		try {
			hand = new FileHandler("MonLog.txt");
			log.addHandler(hand);
			SimpleFormatter formatter=new SimpleFormatter();
			hand.setFormatter(formatter);
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public int getIdSource() {
		return idSource;
	}

	public void setIdSource(int idSource) {
		this.idSource = idSource;
	}

	public int getIdInformation() {
		return idInformation;
	}

	public void setIdInformation(int idInformation) {
		this.idInformation = idInformation;
	}
	
	void parce(byte b1,byte b2){
		
		idSource=b2;
		idInformation=b1;
		
		log.info("Information Parsee =>idSource="+idSource+"  idInformation="+idInformation);
		System.out.println("Parser=>idSource="+idSource+"  idInformation="+idInformation);
		/*	byte tmpb1=b1;
		tmpb1=(byte)(tmpb1>>4);
		typeSource=tmpb1;
		tmpb1=b1;
		int n=Integer.toBinaryString(tmpb1).length();
		tmpb1=(byte)(tmpb1<<4);
		tmpb1=(byte)(tmpb1>>4);
		typeInformation=tmpb1;
		*/
	//	afficherInformation(typeSource,idSource,codeInformation);
	}
}
